package com.zhoux.basics;

/**
 * @author taoyi
 * @version 1.0
 * @date 2021/3/2 9:14
 */
public class OpenDemo {

    public static int fib(int n){ // 斐波那契数列
        int [] results = new int[n];
        for (int i = 0; i < n; i++) {
            if (i<2){
                results[i]=i;
            }else {
                results[i] = results[i-1] + results[i-2]; // 状态转移方程式
            }
        }
        return results[n-1];
    }
    public static void main(String[] args) {
        int result = fib(100);
        System.out.println(result);
    }
}

